#ifndef	_WIN32
#include		"MutexUnix.hpp"

bool			MutexUnix::create(myMutex *var)
{
	bool		ret = true;
	int		retVal = 0;
	
	retVal = pthread_mutex_init(var, NULL);
	if (retVal != 0)
	  ret = false;
	return (ret);
}

void			MutexUnix::destroy(myMutex *var)
{
	pthread_mutex_destroy(var);
	return ;
}

bool			MutexUnix::lock(myMutex *var)
{
	bool				ret = true;
	int				retVal;

	retVal = pthread_mutex_lock(var);
	if (retVal != 0)
	  ret = false;
	return (ret);
}
bool			MutexUnix::tryLock(myMutex *var)
{
	bool				ret = true;
	int				retVal;

	retVal = pthread_mutex_trylock(var);
	if (retVal != 0)
	  ret = false;
	return (ret);
}

bool			MutexUnix::unlock(myMutex *var)
{
	bool				ret = true;
	int				retVal;

	retVal = pthread_mutex_unlock(var);
	if (retVal != 0)
	  ret = false;
	return (ret);
}
#endif /* !_WIN32 */
